<?php

namespace App\Http\Controllers\Api\V2;

use App\Http\Requests\Backend\BannerRequest;
use App\Services\Gallery\Interfaces\BannerServiceInterface;
use App\Services\Gallery\Model\Banner;
use App\Services\Gallery\Services\BannerService;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;

class BannerController extends BaseController
{
    /**
     * @var BannerService
     */
    protected $bannerService;

    public function __construct(BannerServiceInterface $bannerService)
    {
        $this->bannerService = $bannerService;
    }

    public function list()
    {
        $dt = Carbon::now();
        $banners = $this->bannerService->index([
            "day_of_week"=>$dt->dayOfWeek,
            "is_show"=>Banner::SHOW_YES,
            "size"=>100,
        ]);
        $banners = arr2_clear($banners["data"], ["id", "title", "thumb", "sort"]);
        return $this->data($banners);
    }
}
